{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "ca3a496d",
   "metadata": {},
   "source": [
    "# 快速成为深度学习全栈工程师第4课书面作业\n",
    "学号：114499\n",
    "\n",
    "**作业内容：**  \n",
    "1. 【python3.6的安装】安装python3.6、anaconda或miniconda，安装完后使用python -V 确认安装的python版本是3.6及其以上\n",
    "2. 【python练习】自定义一个排序规则函数，可将列表中字符串忽略大小写地，按字母序排列，列表为 [\\'Apple\\', \\'orange\\', \\'Peach\\', \\'banana\\']。提示:字母转换为大写的方法为some_str.upper()，转换为小 写使用some_str.lower()\n",
    "3. 【numpy练习】创建一个随机的numpy矩阵，形状是[10x10]，并取出每列的前3个最大的数，提示：最后的结果形状是【3x10】"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fece1798",
   "metadata": {},
   "source": [
    "## 1. 作业1\n",
    "【python3.6的安装】安装python3.6、anaconda或miniconda，安装完后使用python -V 确认安装的python版本是3.6及其以上。  \n",
    "环境安装完成，安装的是anaconda，python3.8。  \n",
    "基于Jupyter notebook执行结果如下："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "9ffa845c",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "conda 4.11.0\n"
     ]
    }
   ],
   "source": [
    "!conda --version"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "fdb893b6",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Python 3.8.8\n"
     ]
    }
   ],
   "source": [
    "!python -V"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ed76beeb",
   "metadata": {},
   "source": [
    "## 2. 作业2\n",
    "【python练习】自定义一个排序规则函数，可将列表中字符串忽略大小写地，按字母序排列，列表为 ['Apple', 'orange', 'Peach', 'banana']。提示:字母转换为大写的方法为some_str.upper()，转换为小 写使用some_str.lower()。  \n",
    "用代码实现如下："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "ac46533a",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['Apple', 'banana', 'orange', 'Peach']\n"
     ]
    }
   ],
   "source": [
    "a = ['Apple', 'orange', 'Peach', 'banana']\n",
    "a.sort(key=lambda x: x.lower())\n",
    "print(a)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "fbcaa680",
   "metadata": {},
   "source": [
    "## 3. 作业3\n",
    "【numpy练习】创建一个随机的numpy矩阵，形状是[10x10]，并取出每列的前3个最大的数，提示：最后的结果形状是【3x10】。  \n",
    "用代码实现如下："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "c2a41264",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "ed210cf1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[-0.39947144 -0.63792885 -0.23234669 -0.25951306  0.89643874  0.51247878\n",
      "  -1.23195665 -0.71551655 -0.43634913  0.90727438]\n",
      " [ 0.04084431  0.83238404  0.25081192 -0.26859086 -0.84519393  0.8996358\n",
      "  -0.74099231 -1.28309826  0.5263981  -0.15786668]\n",
      " [-0.50856519  1.39331649  0.45054824  0.5246221  -0.47895834  0.69259002\n",
      "  -1.56881144 -0.59629135  0.95397472  0.67844168]\n",
      " [ 0.12302319  0.48454461  0.49332337 -1.2550393  -1.29372536 -0.11532406\n",
      "   0.29574896 -0.74741545  1.0473515  -1.35178641]\n",
      " [-1.13863013  1.02883192  0.51315992  0.84560661  0.72038951 -0.51150088\n",
      "  -0.06299837  0.58229773 -0.92039211  2.26100296]\n",
      " [-1.29535295 -0.16714461 -0.42634683  0.25972525  0.09265179  1.94678661\n",
      "  -0.15191523 -0.20386021  1.42855515 -1.6254638 ]\n",
      " [ 0.20017566  1.00639008  0.82961164  1.28702825  0.4300725   0.67249581\n",
      "   1.37433123  1.80267133  1.19852601  0.28207303]\n",
      " [ 1.89222655  1.47513932 -0.47638892 -0.43129188  0.04364296 -1.05567801\n",
      "   0.36609575 -0.43001637  1.40966313  0.99251343]\n",
      " [ 0.77554215  0.6821771  -0.52261969  0.5231773  -0.46262177 -0.53889801\n",
      "   0.6040346   2.09283838  0.46071308  1.3447916 ]\n",
      " [ 0.05407337 -0.24177356 -0.17024669 -0.839223    1.39064877 -2.01711682\n",
      "   0.56885642 -0.39103808  0.96263667  1.55447412]]\n",
      "(10, 10)\n"
     ]
    }
   ],
   "source": [
    "m = np.random.randn(10,10)\n",
    "print(m)\n",
    "print(m.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "c55af3b1",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[1.40830479 1.24070651 1.6070534  0.59653067 1.70588122 1.37696025\n",
      "  1.33478117 3.18377776 1.47784717 1.00675199]\n",
      " [1.12003799 1.15682865 0.88288131 0.25603096 1.22760192 1.27115777\n",
      "  0.55067514 1.93690266 1.19018506 0.69711117]\n",
      " [0.87098479 1.03083882 0.80498423 0.04298501 1.09936858 1.25406163\n",
      "  0.41328289 1.83930604 0.87593786 0.58708759]]\n",
      "(3, 10)\n"
     ]
    }
   ],
   "source": [
    "n = -1*np.sort(-1*m,axis=0)[0:3,:]\n",
    "print(n)\n",
    "print(n.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "83aac83c",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
